package com.itheima.controller;

import com.itheima.common.Result;
import com.itheima.common.Speed;
import com.itheima.service.DishService;
import com.itheima.vo.UserDishVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author :WuJunJie
 * packageName :com.itheima.controller
 * fileName :DishController
 * creationTime :2022-11-27 13:39
 */
@RestController
@RequestMapping("dish")
@Slf4j
public class DishController {
    @Autowired
    private DishService dishService;

    @GetMapping("list")
    @Speed
    public Result selectDishes(@RequestParam(name="categoryId") String categoryId,
                               @RequestParam(name = "status")Integer status){
        List<UserDishVo> userdishVos=dishService.selectDishes(categoryId, status);
        return Result.success(userdishVos);
    }
}
